<?php

//$keyFile = DB_PASSWORD_PRIVATE_KEY_PATH;
//$privateKey = trim(file_get_contents($keyFile));

$config["master"]= [
    "host"=>DB_MASTER_HOST,
    "database"=>DB_MASTER_DB_NAME,
    "user"=>DB_MASTER_USER,
    "port"=>DB_MASTER_PORT,
//    "password"=>\app\cls\tom\Aes::decrypt(DB_MASTER_PASSWORD,$privateKey),
    "password"=>DB_MASTER_PASSWORD,
    "db_prefix"=>DB_MASTER_DB_PREFIX,
];
$sdb = DB_SLAVE;
$sdb = unserialize($sdb);
$selectedDB = $sdb[mt_rand(0,count($sdb)-1)];
$config["slave"] = [
    "host"=>$selectedDB["host"],
    "port"=>$selectedDB["port"],
    "database"=>$selectedDB["db"],
    "user"=>$selectedDB["user"],
    "password"=>$selectedDB["password"],
    "db_prefix"=>$selectedDB["db_prefix"]
];
//$config["slave"] = [
//    "host"=>DB_SLAVE_HOST,
//    "database"=>DB_SLAVE_DB_NAME,
//    "user"=>DB_SLAVE_USER,
//    "port"=>DB_SLAVE_PORT,
//    "password"=>\app\cls\tom\Aes::decrypt(DB_SLAVE_PASSWORD,$privateKey),
//    "db_prefix"=>DB_SLAVE_DB_PREFIX,
//];
//var_dump($config);exit;
return $config;